package com.sne.airways.system.dao.impl;

import com.sne.airways.basecore.dao.impl.BaseDAOHibernate;
import com.sne.airways.system.dao.LoginDAO;
import com.sne.airways.system.pojo.TdUser;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * Created with IntelliJ IDEA.
 * User: skyline{http://my.oschina.net/skyline520}
 * Date: 12-11-16
 * Time: 下午4:59
 * To change this template use File | Settings | File Templates.
 */
@Repository
public class LoginDAOHibernate extends BaseDAOHibernate implements LoginDAO {
    /**
     * 根据userNo查询用户对象
     *
     * @param userNo
     * @return
     */
    @Override
    public TdUser queryUserObj(String userNo) {
        String hql = " from TdUser t where t.userNo = ? ";
        List list = getHibernateTemplate().find(hql,userNo);
        if(list == null || list.isEmpty() || list.size() == 0){
            return null;
        }
        return (TdUser)list.get(0);
    }
}
